package com.ddd.mill.domain.aggregate.constant.product.constant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * @author liu
 * @title: SellMode
 * @projectName trading-center
 * @date 2020/11/3010:00
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum SellModeEnum {
    /**
     *
     */
    SPECIAL_OFFER(1, "特价"),
    GROUP_BARGAIN(2, "拼团"),
    NEW_PACKAGE(3,"创新包装");

    @EnumValue
    private final Integer value;
    private final String desc;

    SellModeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    @JsonCreator
    public static SellModeEnum get(Integer value){
        for (SellModeEnum e : SellModeEnum.values()) {
            if (e.getValue().equals(value)) {
                return e;
            }
        }
        return null;
    }

}
